/* GTKMM Plugin */

#include "main_interface.hh"

#include <gtkmm/box.h>
#include <gtkmm/main.h>
#include <gtkmm/statusbar.h>

#include "menus.hh"
#include "components/interface_widgets.hh"
#include "components/video_widget.hh"

MainInterface::MainInterface (intf_thread_t *_p_intf) : p_intf (_p_intf)
{

  privacy ();

  set_vlc_window_title ();
  set_position (Gtk::WIN_POS_CENTER);

  Gtk::VBox *vbox = new Gtk::VBox ();

  /* Menu bar */
  vbox->pack_start (*Gtk::manage (new VlcMenuBar (this, p_intf)), false, false);

  VideoWidget *video = new VideoWidget (p_intf);
  vbox->pack_start (video->m_area);

  p_intf->p_sys->p_video = video;

  vbox->pack_start (*Gtk::manage (new ControlsWidget (p_intf)), false, false);

  /* FIXME: Temp */
  vbox->pack_start (*Gtk::manage (new Gtk::Statusbar ()), false, false);

  add (*Gtk::manage (vbox));

  signal_hide ().connect (sigc::ptr_fun (&Gtk::Main::quit));

}

MainInterface::~MainInterface ()
{

  delete p_intf->p_sys->p_video;

}

void
MainInterface::set_vlc_window_title (Glib::ustring title)
{

  if (title.empty ())
    set_title (_("VLC media player"));
  else
    set_title (title + " - " + _("VLC media player"));

}

inline void
MainInterface::privacy ()
{

  /* FIXME: Not yet implemented */

}

